<!DOCTYPE html>
<html>
<head>
    <title>药品类别选择</title>
    <meta charset="utf-8">
    <!-- 指定以IE8的方式来渲染 -->
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
    <link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
    <link type="text/css" rel="stylesheet" href="/css/jsherp.css"/>
    <script type="text/javascript" src="/js/jquery-1.8.0.min.js"></script>
    <link rel="stylesheet" type="text/css" href="/js/easyui/themes/default/easyui.css"/>
    <link rel="stylesheet" type="text/css" href="/js/easyui/themes/icon.css"/>
    <link type="text/css" rel="stylesheet" href="/css/common.css"/>
    <script type="text/javascript" src="/js/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/js/easyui/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="/js/common/common.js"></script>
</head>
<body>
<!-- 数据显示table -->
<div>
    <ul id="ttForSelect"></ul>
</div>

<script type="text/javascript">
    /**
     * create by: qiankunpingtai
     * create time: 2019/3/14 11:41
     * description:
     * 为了防止当前节点选择父级目录为其子代节点造成闭环无法获取的问题
     * 决定对树结构可选父级目录做一个筛选，只能为其上级目录
     *
     */
    $(function () {
        var id=$("#id").val();
        if(id==undefined){
            id='';
        }
        console.log(id);
        $('#ttForSelect').tree({
            url: '/materialCategory/getMaterialCategoryTree?id='+id,
            animate: true,
            onDblClick: function (node) {
                //双击修改
                forSelectMaterialCategory(node);
            }
        });

        function forSelectMaterialCategory(node) {
            console.log(node);
            if(clickType) {
                if(clickType == "selectBtn") {
                    $("#searchParentName").textbox("setValue", node.text);
                    $("#searchParentId").val(node.id);
                    types = "";
                    initMCData(node.id);
                } else if(clickType == "editBtn") {
                    $("#parentName").textbox("setValue", node.text);
                    $("#parentId").val(node.id);
                }
            }
             else {
                $("#parentName").textbox("setValue", node.text);
                $("#parentId").val(node.id);
            }
            $('#forSelectMaterialCategoryDlg').dialog('close');
        }
    });

</script>
</body>
</html>
